package com.wm.base;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;

/**
 * <p>Description: [XXXX]</p>
 * Created on 2017/4/21 0021
 *
 * @author <a href="mailto: jiaweiguang@camelotchina.com">sevelli</a>
 * @version 1.0
 *          Copyright (c) 2016北京柯莱特科技有限公司 交付部 青岛研发中心
 */
public class BaseController {
    protected Logger logger = LoggerFactory.getLogger(getClass());
    public PageRequest buildPageRequest(int pageNo, int pageSize) {

        return buildPageRequest(pageNo - 1, pageSize, null);
    }

    public PageRequest buildPageRequest(int pageNo, int pageSize,Sort sort){
        if(pageNo==0){
            pageNo = 1;
        }
        if(pageSize==0){
            pageSize = 10;
        }
        return new PageRequest(pageNo - 1, pageSize, sort);
    }
}
